﻿function getGeoObjects() {
    var query = $('#geoQuery').val();

    $('#geoObjectsTd').loading(true, { align: 'center', img: '../../Content/jquery.loading.1.6.3/small-loader.gif' });

    $('#geoObjectsListBox').attr('disabled', true);
    $('#geoObjectsListBox').empty();

    $.post("/event/getgeoobjects?query=" + escape(query), null, function (data) {

        if (data.length == 0)
            $('#geoObjectsListBox').append('<option>No object was found</option>');
        else {
            for (var i in data) {
                var geoObject = data[i];
                $('#geoObjectsListBox').append('<option value="' + geoObject.Uri + '">' + geoObject.Name + '</option>');
            }

            $('#geoObjectsListBox').removeAttr('disabled');
        }

        $('#geoObjectsTd').loading(false);

    }, "json");
}
